﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Store/StoreMastePage.Master" AutoEventWireup="true" CodeBehind="PurchaseStationary.aspx.cs" Inherits="logicunivesityinventorystore.Store.PurchaseStationary" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script language="javascript" type="text/javascript">
    function ShowEditModal(ExpanseID) {
        var frame = $get('IframeEdit');
        frame.src = "AddItems.aspx?UIMODE=EDIT&EID=ss";
        $find('EditModalPopup').show();
    }
    function EditCancelScript() {
        var frame = $get('IframeEdit');
        frame.src = "DemoLoading.aspx";
    }
    function EditOkayScript() {
        RefreshDataGrid();
        EditCancelScript();
    }
    function RefreshDataGrid() {
        $get('<%= Button1.ClientID %>').click();
    }
    function NewExpanseOkay() {
        $get('<%= Button1.ClientID %>').click();
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
       <h1> Purchase Stationary</h1>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
         <asp:UpdatePanel ID="UpdatePanel1" runat="server">
           
                <ContentTemplate>

             <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Height="1px" 
                        Width="1px" BackColor="White" />
                    <br /> 
       <br />
       <asp:Label ID="lbExDate" runat="server" Text="Expected Date:"></asp:Label>
    &nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="txtExDate" runat="server" Height="20px" Width="91px"></asp:TextBox>
    <asp:CalendarExtender ID="cal1" runat="server" 
        Enabled="True" TargetControlID="txtExDate"  Format="dd/MM/yyyy">
    </asp:CalendarExtender>
       &nbsp;&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
           ControlToValidate="txtExDate" ErrorMessage="This is required!" 
           SetFocusOnError="True" ValidationGroup="validate" ForeColor="Red"></asp:RequiredFieldValidator>
       <br />
       <br />
       <asp:GridView ID="gvItemList" runat="server" AutoGenerateColumns="False" 
           onrowdatabound="GridView1_RowDataBound" 
           onrowcommand="GridView1_RowCommand">
           <Columns>
               <asp:BoundField HeaderText="Item Code" DataField="ItemCode" />
               <asp:BoundField HeaderText="Description" DataField="Description" />
               <asp:TemplateField HeaderText="Qty">
                   <ItemTemplate>
                       <asp:TextBox ID="txtQty" runat="server" Height="30px" Width="100px" 
                           Text='<%# Eval("Quantity") %>' AutoPostBack="True" 
                           ontextchanged="tbx_qty_TextChanged"></asp:TextBox>
                       <br />
                       <asp:RangeValidator ID="RangeValidator1" runat="server" 
                           ControlToValidate="txtQty" ErrorMessage="Invalid number!" MaximumValue="9999" 
                           MinimumValue="0" ValidationGroup="validate" ForeColor="Red"></asp:RangeValidator>
                   </ItemTemplate>
               </asp:TemplateField>
               <asp:TemplateField HeaderText="Supplier">
                   <ItemTemplate>
                       <asp:DropDownList ID="ddlSupplier" runat="server" Height="30px" Width="100px" 
                           DataTextField="SupplierID" 
                           DataValueField="SupplierID" AppendDataBoundItems="True" 
                           AutoPostBack="True" 
                           onselectedindexchanged="DropDownList1_SelectedIndexChanged">
                       </asp:DropDownList>
                   </ItemTemplate>
               </asp:TemplateField>
               <asp:BoundField HeaderText="Contact No." />
               <asp:BoundField HeaderText="Price($)" />
               <asp:BoundField HeaderText="Amount($)" />
               <asp:TemplateField>
                   <ItemTemplate>
                       <asp:LinkButton ID="lbtnRemove" runat="server" 
                           CommandArgument='<%# Container.DataItemIndex %>' CommandName="Remove">Remove</asp:LinkButton>
                   </ItemTemplate>
               </asp:TemplateField>
           </Columns>
       </asp:GridView>
       <br />
       <br />
       <center>
       <asp:Button ID="btn_Add" runat="server" Text="Add" Height="32px" Width="57px" 
               CssClass="ButtonStyle" />
           <asp:ModalPopupExtender ID="btn_Add_ModalPopupExtender" runat="server" BackgroundCssClass="modalBackground"
                runat="server" CancelControlID="btnCancel" OkControlID="btnOkay" 
               TargetControlID="btn_Add" PopupControlID="Panel1" Drag="true" PopupDragHandleControlID="PopupHeader" OnOkScript="NewExpanseOkay();">
           </asp:ModalPopupExtender>
           <div class="popup_Buttons" style="display: none">
                <input id="btnOkay" value="Done" type="button" />
                <input id="btnCancel" value="Cancel" type="button" />
            </div>
            <div id="Panel1" style="display: none;" class="modalPopup">
                <iframe id="frameeditexpanse" frameborder="0" src="AddItems.aspx" height="270" scrolling="auto"
                    ></iframe>
            </div>
&nbsp;&nbsp;&nbsp;
       <asp:Button ID="btn_Save" runat="server" Text="Save" Height="32px" Width="57px" 
               CssClass="ButtonStyle" onclick="btn_Save_Click" 
               ValidationGroup="validate" />
       </center>
        </ContentTemplate>
            <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
                </Triggers>
        </asp:UpdatePanel>
</asp:Content>

<asp:Content ID="Content3" runat="server" 
    contentplaceholderid="ContentPlaceHolder3">

                </asp:Content>
<asp:Content ID="Content4" runat="server" 
    contentplaceholderid="ContentPlaceHolder5">

                </asp:Content>
<asp:Content ID="Content5" runat="server" 
    contentplaceholderid="ContentPlaceHolder1">

                </asp:Content>
<asp:Content ID="Content6" runat="server" 
    contentplaceholderid="ContentPlaceHolder6">

                </asp:Content>
<asp:Content ID="Content7" runat="server" 
    contentplaceholderid="ContentPlaceHolder7">

                </asp:Content>


